import javax.swing.JComponent;
import javax.swing.JFrame;


public class InterfaceFrame extends JFrame{
	
	private static final long serialVersionUID = 1L;
	WorldMapInterface wmap;
	NodeInterface nface;
	CombatSkeleton cskeleton;
	StartMenu menu;
	int width;
	int height;
	Player player;
	Map map;
	
	public InterfaceFrame(int width, int height, Player player, Map map){
		this.player=player;
		this.map=map;
		this.width = width;
		this.height = height;
		getContentPane().removeAll();
		getContentPane().repaint();
		setSize(width,height);
		setResizable(false);
		setVisible(true);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);	
	}
	public InterfaceFrame(int width, int height){
		//this.player=player;
		/*this.map=map;*/
		this.width = width;
		this.height = height;
		getContentPane().removeAll();
		getContentPane().repaint();
		setSize(width,height);
		setResizable(false);
		setVisible(true);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}
	public InterfaceFrame(int width, int height, Map map){
		//this.player=player;
		this.map=map;
		this.width = width;
		this.height = height;
		getContentPane().removeAll();
		getContentPane().repaint();
		setSize(width,height);
		setResizable(false);
		setVisible(true);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	}
	public void swapToWorldMap(){
		getContentPane().removeAll();
		wmap = new WorldMapInterface(this,player,map);
		getContentPane().add(wmap);
		getContentPane().repaint();
		((JComponent) getContentPane()).revalidate();
	}
	
	public void swapToNewWorldMap(Player player, Map map){
		getContentPane().removeAll();
		this.player=player;
		this.map=map;
		wmap = new WorldMapInterface(this,player,map);
		getContentPane().add(wmap);
		getContentPane().repaint();
		((JComponent) getContentPane()).revalidate();
	}
	
	public void swapToNodeInterface(int nodeIndex, boolean showPets){
		getContentPane().removeAll();
		nface = new NodeInterface(map.getNode(nodeIndex),player,this, showPets);
		getContentPane().add(nface);
		getContentPane().repaint();
		((JComponent) getContentPane()).revalidate();
	}
	
	public void swapToCombatSkeleton(AI opponent, boolean catchable, MapNode node) {
		getContentPane().removeAll();
		cskeleton = new CombatSkeleton(player, opponent, this, catchable, node);
		getContentPane().add(cskeleton);
		getContentPane().repaint();
		((JComponent) getContentPane()).revalidate();
	}
	
	public void swapToStartMenu() {
		getContentPane().removeAll();
		menu= new StartMenu(this);
		getContentPane().add(menu);
		getContentPane().repaint();
		((JComponent) getContentPane()).revalidate();
	}

}
